package src.lab03.test04;

import java.io.*;

/**
 * Created by 阿阿阿阿豪丶 on 2017/12/15.
 */
public class Test {
    public static void main(String[] args) {
 /*       String path = "D:\\hello.txt";
//        BufferedReader bufferedReader = new BufferedReader();
        File file = new File("D:\\");
        file.listFiles();  //File[]
        for (File f:file.listFiles()){
            if (f.isFile()){
                System.out.println("文件："+f.getName());
                String path2 = "D:\\"+f.getName();
                FileInputStream fileInputStream = null;

                try {
                    fileInputStream.read();
                } catch (IOException e) {
                    e.printStackTrace();
                }

                try {
                    fileInputStream = new FileInputStream(new File(path2));
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }


            }
            if (f.isDirectory()){
                System.out.println("目录："+f.getName());
            }

        }*/

        String source = "D:\\jsoup-1.10.2.jar";
        String target = "E:\\jsoup-1.10.2.jar";

        FileInputStream fileInputStream = null;
        FileOutputStream fileOutputStream = null;



        try {
            fileInputStream = new FileInputStream(source);
            fileOutputStream = new FileOutputStream(target);

            int date;

            while((date = fileInputStream.read()) !=-1){
                fileOutputStream.write(date);

            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        finally {

            try {
                fileOutputStream.close();
                fileInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}
